package com.sss.otep.client.grid;

import java.util.ArrayList;
import java.util.List;

public class GridDataModel<T> {
	private Integer page = 0;
	private Integer total = 0;
	private List<T> rows = new ArrayList<T>();
	public Integer getPage() {
		return page;
	}
	public void setPage(Integer page) {
		this.page = page;
	}
	public Integer getTotal() {
		return total;
	}
	public void setTotal(Integer total) {
		this.total = total;
	}
	public List<T> getRows() {
		return rows;
	}
	public void setRows(List<T> rows) {
		this.rows = rows;
	}
	
	// utility methods
	public void addData(T data){
		this.rows.add(data);
		this.updateTotal();
	}
	public void addData(List<T> data){
		this.rows.addAll(data);
		this.updateTotal();
	}
	private void updateTotal(){
		this.total = this.rows.size();
	}
	
}
